const app = require('./app');
const db = require('./config/db');

const PORT = process.env.PORT || 3000;

// 测试数据库连接
db.getConnection()
  .then(() => {
    console.log('数据库连接成功');
    app.listen(PORT, () => {
      console.log(`服务器运行在 http://localhost:${PORT}`);
    });
  })
  .catch(err => {
    console.error('数据库连接失败:', err);
    process.exit(1);
  });